package com.text.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "student_and_course")  // 指定数据库表名
@IdClass(StudentAndCourseId.class)  // 指定复合主键类
public class StudentAndCourse {

    @Id
    @Column(name = "student_id", nullable = false)
    private String studentId;

    @Id
    @Column(name = "course_id", nullable = false)
    private String courseId;

    @Column(name = "description", nullable = true)
    private String description;
}